#include "mysig.h"

static int TIMES = 1;
static int CNT;


void (*signal(int sig, void (*handler)(int sig))) (int sig);

static void my_handler(int sig);

int main() {
    signal(SIGUSR2, my_handler);
    pause();
    return 0;
}


static void my_handler(int sig) {
    signal(SIGUSR2, my_handler);
    CNT = 0;
    printf("Recv signal %d %d times\n", sig, TIMES++);
    while (1) {
        // printf("hello world %d\n", CNT++);
        sleep(5);
    }
}
